import 'package:flutter/material.dart';

class RealSizedBox extends StatelessWidget {
  final double _width;
  final double _height;
  final Widget _child;
  const RealSizedBox(
      {Key? key,
      required double width,
      required double height,
      required Widget child})
      : _width = width,
        _height = height,
        _child = child,
        super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(children: [
      Expanded(
          child: Container(
        margin: const EdgeInsets.all(0.0),
        padding: const EdgeInsets.all(0.0),
        color: Colors.transparent,
      )),

      /// 只有一列，说明这里是写的三行，因此中间这一行要固定行高
      SizedBox(
        height: _height,
        width: _width,

        /// 上面中间行又分为了三列
        child: Row(
          children: [
            Expanded(
                child: Container(
              margin: const EdgeInsets.all(0.0),
              padding: const EdgeInsets.all(0.0),
              color: Colors.transparent,
            )),

            /// 中间列写明宽度
            SizedBox(
                width: _width,
                height: _height,
                // 要透明，好中间这块能显示下层
                child: _child),
            Expanded(
                child: Container(
              margin: const EdgeInsets.all(0.0),
              padding: const EdgeInsets.all(0.0),
              color: Colors.transparent,
            )),
          ],
        ),
      ),
      Expanded(
          child: Container(
        margin: const EdgeInsets.all(0.0),
        padding: const EdgeInsets.all(0.0),
        color: Colors.transparent,
      )),
    ]);
  }
}
